/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.manage.core.service.api;

import com.alibaba.fastjson2.JSON;
import info.peigen.hotpot.component.doc.core.annotation.Api;
import info.peigen.hotpot.component.open.api.facade.OpenApiServiceFacade;
import info.peigen.hotpot.component.open.api.facade.processor.base.OpenApiProcessorServiceContext;
import info.peigen.hotpot.manage.core.service.order.UserCreateOrder;
import info.peigen.hotpot.manage.core.service.result.UserCreateResult;
import org.noear.solon.annotation.Component;

/**
 * <b>(UserCreateApiService)</b>
 * "用户" 创建Api服务
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2024-06-28
 */
@SuppressWarnings({"rawtypes", "unchecked", "unused"})
@Api(name = "用户创建服务", code = "userCreateApiService", order = UserCreateOrder.class, result = UserCreateResult.class)
@Component("userCreateApiService")
public class UserCreateApiService extends AbstractHotpotManageApiService implements OpenApiServiceFacade {
    @Override
    public void execute(OpenApiProcessorServiceContext serviceContext) {
        UserCreateOrder  order  = JSON.parseObject(serviceContext.getApi().getDecrypt(), UserCreateOrder.class);
        UserCreateResult result = userService.create(order);
        serviceContext.setResult(result);
    }
}